public class VarArguments {

    public static void main(String[] args) {
        System.out.println(add(2, 5));
        System.out.println(add(3 , 6.5, 12.0));
    }

    private static double add(double ... x){
    	double sum = 0;
    	for(int k = 0; k < x.length; k++)
    		sum += x[k];

    	return sum;
    }
}
